﻿@using MVCSoict.Views.Shared.Data
@model IEnumerable<MVCSoict.Models.User>

@{
	ViewBag.Deny = false;
	ViewBag.Title = "Index";
	Layout = "~/Views/Shared/_Layout.cshtml";
}

@if (ViewBag.Deny == true)
{
	<script defer="defer" src="/Scripts/Soict/User_Alt.js"></script>
}
else
{

	<h2>Danh sách người dùng</h2>
	@Html.Partial("_PaginationPartial")
	<table class="table">
		<tr>
			<th>
				@Html.DisplayNameFor(model => model.password)
			</th>
			<th>
				@Html.DisplayNameFor(model => model.name)
			</th>
			<th>
				@Html.DisplayNameFor(model => model.room)
			</th>
			<th>
				@Html.DisplayNameFor(model => model.email)
			</th>
			<th>
				@Html.DisplayNameFor(model => model.phone)
			</th>
			<th>
				@Html.DisplayNameFor(model => model.fax)
			</th>
			<th>
				@Html.DisplayNameFor(model => model.avartar)
			</th>
			<th>
				@Html.DisplayNameFor(model => model.student)
			</th>
			<th>
				@Html.DisplayNameFor(model => model.state)
			</th>
			<th>
				@Html.DisplayNameFor(model => model.details)
			</th>
			<th></th>
		</tr>

		@foreach (var item in Model)
		{
			<tr>
				<td>
					@Html.DisplayFor(modelItem => item.password)
				</td>
				<td>
					@Html.DisplayFor(modelItem => item.name)
				</td>
				<td>
					@Html.DisplayFor(modelItem => item.room)
				</td>
				<td>
					@Html.DisplayFor(modelItem => item.email)
				</td>
				<td>
					@Html.DisplayFor(modelItem => item.phone)
				</td>
				<td>
					@Html.DisplayFor(modelItem => item.fax)
				</td>
				<td>
					@Html.DisplayFor(modelItem => item.avartar)
				</td>
				<td>
					@Html.DisplayFor(modelItem => item.student)
				</td>
				<td>
					@Html.DisplayFor(modelItem => item.state)
				</td>
				<td>
					@Html.DisplayFor(modelItem => item.details)
				</td>
				<td>
					@Html.Partial("_ControlPartial", new Item { ID = item.username })
				</td>
			</tr>
		}

	</table>


	<div id="editUserModal" class="reveal-modal small" data-reveal>
		@*Tạo một biến mới*@
		@{var editmodel = new MVCSoict.Models.User();}

		@using (Html.BeginForm())
		{

			<div id="editUserSonForm" class="form-horizontal">
				<h4>Sửa thông tin cho<span id="usernameS"></span></h4>
				<hr />
				@Html.ValidationSummary(true)
				@Html.HiddenFor(model => editmodel.username)

				@Html.HiddenFor(model => editmodel.password)

				<div class="form-group">
					<a>Tạo lại mật khẩu</a>
				</div>

				<div class="row collapse">
					<div class="small-2 columns">
						<span class="prefix">Họ tên</span>
					</div>
					<div class="small-10 columns">
						@Html.EditorFor(model => editmodel.name)
						@Html.ValidationMessageFor(model => editmodel.name)
					</div>
				</div>

				<div class="row collapse">
					<div class="small-2 columns">
						<span class="prefix">Học hàm</span>
					</div>
					<div class="small-9">
						<div id="titleBoard">

						</div>
					</div>
					<div class="small-1 columns">
						<a id="userAddTitleBt" class="button tiny">Thêm học hàm</a>
					</div>
				</div>

				<div class="row collapse">
					<div class="small-2 columns">
						<span class="prefix">Dự án</span>
					</div>
					<div class="small-9">
						<div id="projectBoard">

						</div>
					</div>
					<div class="small-1 columns">
						<a id="userAddProjectBt" class="button tiny">Thêm dự án</a>
					</div>
				</div>

				<div class="row collapse">
					<div class="small-2 columns">
						<span class="prefix">Chức danh</span>
					</div>
					<div class="small-9">
						<div id="roleBoard">

						</div>
					</div>
					<div class="small-1 columns">
						<a id="userAddRoleBt" class="button tiny">Thêm chức danh</a>
					</div>
				</div>


				<div class="row collapse">
					<div class="small-2 columns">
						<span class="prefix">Phòng làm việc</span>
					</div>
					<div class="small-10 columns">
						@Html.EditorFor(model => editmodel.room)
						@Html.ValidationMessageFor(model => editmodel.room)
					</div>
				</div>

				<div class="row collapse">
					<div class="small-2 columns">
						<span class="prefix">Email</span>
					</div>
					<div class="small-10 columns">
						@Html.TextAreaFor(model => editmodel.email)
						@Html.ValidationMessageFor(model => editmodel.email)
					</div>
				</div>

				<div class="row collapse">
					<div class="small-2 columns">
						<span class="prefix">Điện thoại</span>
					</div>
					<div class="small-10 columns">
						@Html.TextAreaFor(model => editmodel.phone)
						@Html.ValidationMessageFor(model => editmodel.phone)
					</div>
				</div>

				<div class="row collapse">
					<div class="small-2 columns">
						<span class="prefix">Fax</span>
					</div>
					<div class="small-10 columns">
						@Html.EditorFor(model => editmodel.fax)
						@Html.ValidationMessageFor(model => editmodel.fax)
					</div>
				</div>

				<div class="row collapse">
					<div class="small-2 columns">
						<span class="prefix">Avatar</span>
					</div>
					<div class="small-10 columns">
						@Html.EditorFor(model => editmodel.avartar)
						@Html.ValidationMessageFor(model => editmodel.avartar)
					</div>
				</div>

				<div class="row collapse">
					<div class="small-2 columns">
						<span class="prefix">Sinh viên cao học</span>
					</div>
					<div class="small-10 columns">
						@Html.TextAreaFor(model => editmodel.student)
						@Html.ValidationMessageFor(model => editmodel.student)
					</div>
				</div>




				@*<div class="form-group">
						@Html.LabelFor(model => editmodel.state, new { @class = "control-label col-md-2" })
						<div class="col-md-10">
							@Html.EditorFor(model => editmodel.state)
							@Html.ValidationMessageFor(model => editmodel.state)
						</div>
					</div>*@


				<div class="row collapse">
					<div class="small-2 columns">
						<span class="prefix">Thông tin thêm</span>
					</div>
					<div class="small-10 columns">

						@Html.TextAreaFor(model => editmodel.details)
						@Html.ValidationMessageFor(model => editmodel.details)
					</div>
				</div>

				<div class="row ">
					<div class="columns small-12 right">
						<a id="editmodel_saveButton" class="button">Lưu</a>
						<a id="editmodel_cancelButton" class="button secondary">Hủy</a>
					</div>

				</div>


			</div>
		}

	</div>

	<script defer="defer" src="/Scripts/Soict/Board.js"></script>
	<script defer="defer" src="/Scripts/Soict/User.js"></script>
}